<?php
if(!defined('MID_APP')) exit('Access Denied');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{$title} - {$xTitle}</title>

<!-- Style Start -->
<link type="text/css" rel="stylesheet" media="all" href="{$style}css/base.css" />
<link type="text/css" rel="stylesheet" media="all" href="{$style}css/jquery-ui.css" />
<link type="text/css" rel="stylesheet" media="all" href="{$style}css/grid.css" />
<link type="text/css" rel="stylesheet" media="all" href="{$style}css/visualize.css" />
<style type="text/css">
<!--
/* -----------------------------
 * 浏览器缩放最小支持992像素;
 * 不支持800x600分辨率设备访问
 * ----------------------------- */
body{
    min-width: 985px;
}
-->
</style>
<!-- Style End -->

<!-- Script Start -->
<script type="text/javascript" src="{:js('core.js')}"></script>
<script type="text/javascript" src="{:js('ui.js')}"></script>
<script type="text/javascript" src="{$style}js/excanvas.js"></script>
<script type="text/javascript" src="{$style}js/visualize.jQuery.js"></script>
<script type="text/javascript" src="{$style}js/functions.js"></script>
<script type="text/javascript" src="{$style}js/common.js"></script>
<script type="text/javascript" src="{$root}js/functions.js"></script>
<script type="text/javascript">
$(function(){
    /* -----------------------------
     * Sidebar Toggle 监听折叠菜单
     * ----------------------------- */
    $(".my-menu > .ul-header > a").click(function(){
        var _id = $(this).attr("id");
            _id = _id.split("-");
            _id = ".my-menu > #"+ _id[1];
        if($(this).hasClass("hidden")) {
            $(this).removeClass('hidden').addClass('visible');
            $(_id).slideDown();
        } else {
            $(this).removeClass('visible').addClass('hidden');
            $(_id).slideUp();
        }
    });
});

/* -----------------------------
 *  JS控制URL
 * ----------------------------- */
function t(url)
{
    $("#ifhome_re").attr("src", url);
}

/* -----------------------------
 *  菜单动作
 * ----------------------------- */
function menuAction(_type, _url)
{
    var _Prefix = "mid_";
    var _re     = $("#sidebar > .my-menu");
    var _length = _re.length-1;
	    _type   = explode(',', _type.toString());

	var tp = new Array();
	for(tp in _type){
		_type[tp] = _Prefix + _type[tp];
	}

	var i = 0;
    var _id;
    for(i;i<=_length;i++){
        _id=_re.eq(i).attr("id");
        if(_id=="mid_statistics" || _id=="continue"){
            continue;
        }else if(in_array(_id,_type)){
            $(_re[i]).show();
        }else{
            $(_re[i]).hide();
        }
    }

    if(_url){
		t(_url);
	}
    return false;
}

/* -----------------------------
 * 自动根据iframe内容调增高度
 * ----------------------------- */
function reinitIframe(){
    var iframe = document.getElementById("ifhome_re");
    try{
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height =  height;
    }catch (ex){}
}

window.setInterval("reinitIframe()", 500);

</script>
<!-- Script End -->
</head>

<body>
<div id="header">
  <div class="header-top tr">
    <p>你好 <strong>Midnight</strong> | 你有 <a href="#" id="opener" class="strong">1 条新消息</a> | <a href="#">设置</a> | <a href="{:U('Public/logout')}">退出</a></p>

    <!-- 新消息页面 start dialogue box -->
    <div id="dialog" title="Messages">
      <div class="notification info"> <span class="strong">INFORMATION!</span> You have 1 new message. </div>

      <!-- start new message -->
      <div class="message new">
        <h4>Welcome...<small class="fr">28rd April 2010 from <a href="#">MaestroX</a></small></h4>
        <p> This is an example of the dialog box. It's powered by jQuery UI so there's tons of options and it's flexible. Checkout the documentation for more information.</p>
      </div>
      <!-- end new message -->
      <!-- start old message -->
      <div class="message">
        <h4>Old Message<small class="fr">28rd April 2010 from <a href="#">System</a></small></h4>
        <p> Welcome to your shiny new admin panel. Take a look around!</p>
      </div>
      <!-- end old message -->
      <!-- start write new message -->
      <form method="post" action="">
        <h3>New Message</h3>
        <fieldset>
          <textarea rows="5" cols="55" name="textfield" class="textarea" style="width:97%"></textarea>
        </fieldset>
        <fieldset>
          <input type="submit" value="Send" class="button medium fr" />
        </fieldset>
      </form>
      <!-- end write new message -->
    </div>

    <!-- end dialogue box -->
  </div>


  <div class="header-middle">
    <!-- Start Nav -->
    <ul id="nav" class="fr ">
      <!-- Nav - Start Help -->
      <li class="help"><a class="help" href="javascript:;">帮助</a>
        <ul>
          <li><a href="#">文档</a></li>
          <li><a href="#">论坛</a></li>
          <li><a href="#">联系</a></li>
        </ul>
      </li>
      <!-- Nav - End Help -->
      <!-- Nav - Start Settings -->
      <li class="settings"><a class="settings" href="javascript:;">设置</a>
        <ul>
          <li><a href="#">系统设置</a></li>
          <li><a href="#">服务安装</a></li>
        </ul>
      </li>
      <!-- Nav - End Settings -->
      <!-- Nav - Start Users -->
      <li class="users"><a class="users" href="javascript:;"> 会员  </a>
        <ul>
          <li><a href="javascript:;" onclick="return menuAction('user', '{:U('member/manage')}');"> 会员中心 </a></li>
          <li><a href="#"> 用户报告 </a></li>
          <li><a href="javascript:;"> Rbac管理  &raquo;</a>
            <ul>
              <li><a href="javascript:;" onclick="menuAction('role', '{:U('role/manage')}')"> 角色管理 </a></li>
              <li><a href="javascript:;" onclick="menuAction('role', '{:U('node/manage')}')"> 节点管理  </a></li>
            </ul>
          </li>
        </ul>
      </li>
      <!-- Nav - End Users -->
      <!-- Nav - Start Content -->
      <li class="content"><a class="content" href="javascript:;">内容</a>
        <ul>
          <li><a href="#">栏目管理  &raquo;</a>
            <ul>
              <li><a href="javascript:;" onclick="menuAction('column', '{:U('column/manage')}');">栏目列表</a></li>
              <li><a href="#">添加栏目</a></li>
              <li><a href="#"></a></li>
            </ul>
          </li>
          <li><a href="#">Page Statstics</a></li>
          <li><a href="#">Page Categories</a></li>
          <li><a href="#">Page Tags</a></li>
        </ul>
      </li>
      <!-- Nav - End Content -->
      <!-- Nav - Start Help -->
      <li class="dashboard"><a class="dashboard" href="#">Dashboard</a></li>
      <!-- Nav - End Dashboard -->
    </ul>
    <!-- End Nav -->
    <!-- Start Logo -->
    <img id="logo" src="{$style}img/logo.png" alt="Admin Theme" />
    <!-- End Logo -->
    <br class="cl" />
  </div>
  <div class="header-bottom">
    <!-- Start Breadcrumbs -->
    <ul id="breadcrumbs">
      <li><a href="#">Base</a> &raquo;</li>
      <li><a href="#">Level One</a> &raquo;</li>
      <li><a href="#">Level Two</a></li>
    </ul>
    <!-- End Breadcrumbs -->
  </div>
</div>

<div id="page-wrapper">
  <div class="page">

    <!-- Start Sidebar -->
    <div id="sidebar">

        <!-- Start Column -->
        <div class="my-menu" id="mid_column">
            <span class="ul-header"><a id="toggle-columnnav" href="javascript:;" class="toggle visible"> 栏目管理 </a></span>
            <ul id="columnnav">
                <li><a href="javascript:;" onclick="t('{:U('column/manage')}');"> 栏目列表 </a></li>
                <li><a href="javascript:;" onclick="t('{:U('column/add')}');"> 添加栏目 </a></li>
            </ul>
        </div>

        <!-- Start Users -->
        <div class="my-menu" id="mid_user">
            <span class="ul-header"><a id="toggle-usersnav" href="javascript:;" class="toggle visible">会员管理</a></span>
            <ul id="usersnav">
                <li><a href="javascript:;" onclick="t('{:U('member/manage')}')">会员列表</a></li>
                <li><a href="javascript:;" onclick="t('{:U('member/add')}');">添加会员</a></li>
                <li><a href="javascript:;" onclick="t('{:U('member/search')}')">检索会员</a></li>
            </ul>
        </div>

        <!-- Start Role  -->
        <div class="my-menu" id="mid_role">
            <span class="ul-header"><a id="toggle-rolenav" href="javascript:;" class="toggle visible">角色管理</a></span>
            <ul id="rolenav">
                <li><a href="javascript:;" onclick="t('{:U('role/manage')}')">角色列表</a></li>
                <li><a href="javascript:;" onclick="t('{:U('role/add')}')">添加角色</a></li>
                <li><a href="javascript:;" onclick="t('{:U('node/manage')}')">节点管理</a></li>
            </ul>
        </div>
        <!--
          Start Statistics Area

          // TODO: 增加ajax支持手动、自动及时显示最新数据
        -->
        <span class="ul-header" id="mid_statistics">统计</span>
        <ul>
            <li>页面： <span>183</span></li>
            <li>评论： <span>432</span></li>
            <li>用户： <span>1095</span></li>
        </ul>

    </div>
    <!-- End Sidebar  -->

    <!-- Star Page Content  -->
    <div id="page-content">
    <iframe src="{:U('iframe/home')}" id="ifhome_re" name="iframe_re" scrolling="no" frameborder="0" width="100%" height="100%" style="z-index:10;" ></iframe>
    </div>
    <!-- End Page Content  -->
  </div>
</div>

<!-- Start Footer -->
<div class="footer"> Copyright © 2010, <a href="http://www.midnight-soft.cn">Midnight Studio</a>. </div>
<!-- End Footer -->
</body>
</html>